package com.huike.web.controller.report;


import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

import javax.xml.crypto.Data;
import java.util.Date;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;


    /**
     * 首页--基础数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime,endCreateTime));
    }

    /**
     * 查询今日简报
     * @return
     */
    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo(){
        Map<String, Integer> map = reportService.getTodayInfo();
        return AjaxResult.success("操作成功",map);
    }

    @GetMapping("/getTodoInfo")
    public AjaxResult getTodoInfo(@RequestParam String beginCreateTime,@RequestParam String endCreateTime){
        Map<String, Integer> map = reportService.getTodoInfo(beginCreateTime, endCreateTime);
        return AjaxResult.success("操作成功",map);
    }

    /**
     * 线索转化龙虎榜
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/salesStatistic")
    public AjaxResult salesStatistic(@RequestParam String beginCreateTime,@RequestParam String endCreateTime){
        List<Map<String,Object>> list= reportService.salesStatistic(beginCreateTime,endCreateTime);
        return AjaxResult.success("操作成功",list);
    }

    /**
     * 商机转化龙虎榜
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/businessChangeStatistics")
    public AjaxResult businessChangeStatistics(@RequestParam String beginCreateTime,@RequestParam String endCreateTime){
        List<Map<String,Object>> list= reportService.businessChangeStatistics(beginCreateTime,endCreateTime);
        return AjaxResult.success("操作成功",list);
    }
}